# Contributor: Frank Felhoffer <silveraid@hackme.ca>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=softhsm
pkgver=2.6.1
pkgrel=4
pkgdesc="cryptographic store accessible through a PKCS #11"
url="https://www.opendnssec.org/softhsm/"
arch="all"
license="BSD-2-Clause"
depends="sqlite"
checkdepends="cppunit-dev"
makedepends="autoconf automake botan-dev libtool p11-kit-dev sqlite-dev"
subpackages="$pkgname-doc"
source="https://dist.opendnssec.org/source/softhsm-$pkgver.tar.gz
	"
options="!check"  # hangs on the builders

prepare() {
 	default_prepare
	update_config_guess
	update_config_sub
}

build() {
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--with-crypto-backend=botan \
		--with-botan=/usr \
		--with-sqlite3=/usr \
		--with-objectstore-backend-db
	make
}

check() {
	make check
	ldd src/lib/.libs/libsofthsm2.so
}

package() {
	make -j1 DESTDIR="$pkgdir/" install
}

sha512sums="e77137096ff2ac2f5396971efbaa2007188855a8f723cb511182c6c5e5a353b3f98297442758e77a18c3a378c0ca3fce8abe090977f0f4f8d526de204fd523fb  softhsm-2.6.1.tar.gz"
